package com.cnebula.openapi.auth.authtoken;

import io.vertx.core.json.JsonObject;

public class UserInfo {

	String id;
	String loginId;
	String username;
	
	public UserInfo(){}

	public UserInfo(JsonObject obj) {
		this.id = obj.getString("id");
		this.loginId = obj.getString("username");
		JsonObject personal = obj.getJsonObject("personal");
		if (personal != null) {
			String firstName = personal.getString("firstName");
			String lastName = personal.getString("lastName");
			if (lastName != null) {
				username = lastName;
			}
			if (firstName != null) {
				username += firstName;
			}
		}
	}

	public String getId() {
		return id;
	}

	public String getLoginId() {
		return loginId;
	}

	public String getUsername() {
		return username;
	}

}
